#!/usr/bin/env python
#! -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django import *
from django.db import models

from django.contrib import admin


class com_intro(models.Model):
    img_url = models.ImageField(
        u'简介图片', upload_to='index_intro_img', blank=True)
    content = models.TextField(u'简介内容', blank=True)
    com_address = models.CharField(u'第一行联系方式', blank=True, max_length=30)

    publish_date = models.DateField(auto_now_add=True, blank=True)
    latest_date = models.DateField(auto_now=True, blank=True)

    def __unicode__(self):  # 在Python3中用 __str__ 代替 __unicode__
        return '公司简介'

    class Meta:
        verbose_name = '公司简介'
        verbose_name_plural = '公司简介'
        ordering = ['publish_date']


class contact(models.Model):
    title = models.CharField(u'联系方式', blank=True, max_length=30)
    text = models.CharField(u'联系方式内容', blank=True, max_length=30)

    publish_date = models.DateField(auto_now_add=True, blank=True)
    latest_date = models.DateField(auto_now=True, blank=True)

    def __unicode__(self):  # 在Python3中用 __str__ 代替 __unicode__
        return self.title

    class Meta:
        verbose_name = '联系方式'
        verbose_name_plural = '联系方式'
        ordering = ['publish_date']


class common_admin(admin.ModelAdmin):
    class Media:
        js = (
            '/media/js/jquery-1.8.3.min.js',
            '/media/js/jquery.form.js',
            # '/media/js/django_ajax.js',
            '/media/js/tinymce/tinymce.min.js',
            '/media/js/textareas.js',
        )
